package decrypt

import (
	"fmt"
	"strings"

	"gitee.com/micro-plat/sas/sas/modules/auth/conf"
	"gitee.com/micro-plat/sas/sas/modules/util"
)

//rsaDecryptMap 解密rsa数据map
func rsaDecryptMap(data map[string]string, key, sType string, cfg *conf.AuthConfig) (map[string]string, error) {
	sType = strings.ToUpper(sType)
	for k, v := range data {
		dec, err := util.RSADecrypt(v, key, sType)
		if err != nil {
			return nil, fmt.Errorf("RSA解密出错: %v", err)
		}
		data[k] = dec
	}
	return data, nil
}
